package com.qujia.station.controller;

import com.qujia.common.core.domain.AjaxResult;
import com.qujia.station.domain.dto.CouponPushMessageRuleDto;
import com.qujia.station.service.CouponPushMessageRuleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/couponPushMessageRule")
@Api(tags = "优惠券到期提醒规则设置")
public class CouponPushMessageRuleController {

    @Autowired
    private CouponPushMessageRuleService couponPushMessageRuleService;

    @PostMapping("/addOrUpdateCouponPushMessageRule")
    @ApiOperation("新增或修改优惠券消息推送规则")
    public AjaxResult addOrUpdateCouponPushMessageRule(@RequestBody CouponPushMessageRuleDto couponPushMessageRuleDto){
      return AjaxResult.success(couponPushMessageRuleService.addOrUpdateCouponPushMessageRule(couponPushMessageRuleDto));
    }

    @GetMapping("/selectCouponPushMessageRule")
    @ApiOperation("查看优惠券消息推送规则")
    public AjaxResult selectCouponPushMessageRule(){
        return AjaxResult.success(couponPushMessageRuleService.selectCouponPushMessageRule());
    }
}
